<template>
	<view class="content">
		<navbar title='明星法务'>
		</navbar>
		<!-- <uv-navbar leftIcon="arrow-leftward" title="试卷列表" leftIconColor="#333" placeholder autoBack bgColor="#fff" :titleStyle="titleStyle"></uv-navbar> -->
		<u-sticky offset-top="0">
			<view class="souview">
				<view class="shaiview" @click="dishow=true">
					<text class="shainame">{{ diinfo?diinfo:'所在区域' }}</text>
					<image class="icon_sx" src="@/static/new/icon_sx.png"></image>
				</view>
				<view class="shaiview" @click="nianshow=true">
					<text class="shainame">{{ nian?nian:'工作年限' }}</text>
					<image class="icon_sx" src="@/static/new/icon_sx.png"></image>
				</view>
			</view>
		</u-sticky>
		<view class="fone">

			<view class="list">
				<view class="item" v-for="(item,index) in list" :key="index" @click="getDetail(item)">
					<image class="itemimg" :src="item.img"></image>
					<view class="ritem">
						<view class="ione">
							<text class="name">{{item.name}}</text>
							<view class="zhiye">
								<image class="icon_rz" src="/static/img/icon_rz.png"></image>
								<text class="zhinian">{{item.law_firm}}</text>
							</view>
							<text class="dizhi">{{item.province+item.city+item.area}}</text>
							
						</view>
						<view class="itwo">
							<view class="titem" v-for="(i,ind) in item.labels">{{i}}</view>
						</view>
						<text class="nianxian">工作年限：{{ item.life+'年' }}</text>
					</view>
				</view>
				<view class="nodata" v-if="list == ''">
					<u-empty text="暂无数据" mode="list" ></u-empty>
				</view>
			</view>

		</view>

		<!-- 年份搜索 -->
		<u-select v-model="nianshow" :list="nianlist" @confirm="confirm"></u-select>
		<!-- 地址 -->
		<Adresspop :dishow="dishow" @adressclose="dishow=false" @adressbtn="adressbtn"></Adresspop>
	</view>
</template>

<script>
import Adresspop from "@/components/Adresspop/Adresspop";
	export default {
		components:{
			Adresspop
		},
		data() {
			return {
				titleStyle:{
					fontWeight: 'bold',
					fontSize: '36rpx',
					color: '#111111',
				},
				value:'',
				list: [],
				page: 1,
				limit: 10,
				last_page: 1,
				status: "loadmore",
				uinfo:{},
				life_search:'',
				nianlist:[
					// {
					// 	value: '1',
					// 	label: '江'
					// },
					// {
					// 	value: '2',
					// 	label: '湖'
					// }
				],
				nian:'',
				nianid:'',
				nianshow:false,
				dishow:false,
				newdiinfo:{
					provinceid:'',
					cityid:'',
					areaid:''
				},
				diinfo:''

			}
		},
		onLoad() {
			this.getList()
		},
		onShow() {
		},
		onReachBottom: function () {
			this.loadmore();
		},
		methods: {
			async getList(){//列表数据
				let res = await this.$u.api.lawyer({
					limit:this.limit,
				  	page:this.page,
					life_search:this.nianid,
					province_id:this.newdiinfo.provinceid,
					city_id:this.newdiinfo.cityid,
					area_id:this.newdiinfo.areaid,
				});
				// console.log(res)
				let life_search = res.life_search
				let shuzu = []
				for(let i in life_search){
					let a = {}
					a.value = i
					a.label = life_search[i]
					shuzu.push(a)
				}
				this.nianlist = shuzu
				this.last_page = res.list.last_page;
				let list = res.list.list;
				this.list = this.page == 1 ? list : [...this.list, ...list];	
				if(this.page >= this.last_page){
				  this.status = 'nomore';
				}
				
			},
			loadmore() {
				let page = this.page;
				if (this.status == 'loadmore') {
					this.page++;
					this.getList();
				}
			},
			getDetail(item){
				this.navrouter("/pages/TPage/SharedDetail?id="+item.id);
			},
			confirm(e){
				console.log(e)
				this.nianid =e[0].value
				this.nian =e[0].label
				this.getClear()
			},
			getClear(){
				this.list = []
				this.page = 1,
				this.status= "loadmore"
				this.getList()
			},
			async adressbtn(e){
				console.log(e)
				this.newdiinfo = e
				this.diinfo = this.newdiinfo.province+'-'+this.newdiinfo.city+'-'+this.newdiinfo.area
				this.getClear()
			},
		}
	}
</script>

<style scoped lang="scss">
	.content {
		min-height: 100vh;
		background-color: #fff;
		

		.souview{
			background-color: #fff;
			padding: 20rpx 30rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			.shaiview{
				display: flex;
				flex-direction: row;
				align-items: center;
				padding: 15rpx;
				background: #EEEEEE;
				border-radius: 10rpx;
				margin-right: 20rpx;
				.shainame{
					font-weight: 500;
					font-size: 24rpx;
					color: #51565D;
				}
				.icon_sx{
					width: 24rpx;
					height: 24rpx;
					margin-left: 10rpx;
				}
			}
			
			.souitem{
				height: 78rpx;
				background: #F5F5F5;
				border-radius: 39rpx;
				display: flex;
				align-items: center;
				flex-direction: row;
				padding: 0 23rpx;
				width: 100%;
				.icon_sousuo{
					width: 24rpx;
					height: 24rpx;
					margin-right: 15rpx;
				}
				.soubtn{
					margin-left: 20rpx;
					width: 100rpx;
					height: 50rpx;
					background: #3E65E5;
					border-radius: 25rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #FFFFFF;
				}
			}
		}
		.fone{
			.flist{
				display: flex;
				flex-direction: row;
				flex-wrap: wrap;
				.fitem{
					width: 25%;
					display: flex;
					flex-direction:column;
					align-items: center;
					justify-content: center;
					margin-bottom: 44rpx;
					text{
						display: inline-block;
						margin-top: 13rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
					}
					.ficon{
						width: 80rpx;
						height: 80rpx;
					}
				}
			}
			.shenhe{
				height: 60rpx;
				background: #F3F6F9;
				border-radius: 10px;
				padding: 0 30rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				.shenitem{
					width: 33.33%;
					display: flex;
					flex-direction: row;
					align-items: center;
					border-right: 1rpx solid rgba(62,101,229,0.3);
					justify-content: center;
					.shenone{
						margin-right: 3rpx;
						width: 33rpx;
						height: 33rpx;
					}
					.shentit{
						font-family: PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: #3C66DE;

					}
				}
				.shenitem:last-child{
					border-right: none;
				}
			}

			.leiview{
				width: 100%;
				.leiscview{
					white-space: nowrap;
					// overflow-x: auto;
					.leiitem{
						display: inline-block;
						padding: 20rpx 40rpx;
						background: #EEEEEE;
						border-radius: 16rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
						margin-right: 20rpx;
					}
					.lactive{
						background: #3E65E5;
						color: #fff;

					}
				}
				
			}
		}
		.list{
			display: flex;
			flex-direction: row;
			flex-wrap: wrap;

			.item{
				width: 100%;
				display: flex;
				flex-direction: row;
				margin-bottom: 20rpx;
				padding: 30rpx;
				border-bottom: 1rpx solid #eee;
				position: relative;
				// border: 1rpx solid #eee;
				// box-shadow: 0px 3rpx 9rpx 0px rgba(109,109,109,0.1);
				.itemimg{
					width: 150rpx;
					height: 150rpx;
					border-radius: 10rpx;
					margin-right: 30rpx;
				}
				.ritem{
					display: flex;
					flex: 1;
					flex-direction: column;
					padding-top: 10rpx;

					.ione{
						display: flex;
						flex-direction: row;
						align-items: center;
						.name{
							font-family: PingFang SC;
							font-weight: bold;
							font-size: 32rpx;
							color: #333333;
							display: inline-block;
							margin-right: 20rpx;
						}
						.zhiye{
							padding: 5rpx 12rpx;
							background: #E2FEF5;
							border-radius: 16rpx;
							display: flex;
							flex-direction: row;
							align-items: center;
							.icon_rz{
								margin-right: 14rpx;
								width: 26rpx;
								height: 26rpx;
							}
							.zhinian{
								font-family: PingFang SC;
								font-weight: bold;
								font-size: 20rpx;
								color: #34C99C;
							}
							
						}
						.dizhi{
							margin-left: auto;
							font-family: PingFang SC;
							font-weight: bold;
							font-size: 24rpx;
							color: #666666;
						}
					}
					.nianxian{
						font-size: 24rpx;
						color: #666666;
						font-weight: 400;
					}
					.itwo{
						display: flex;
						flex-direction: row;
						flex-wrap: wrap;
						margin: 20rpx 0;
						.titem{
							padding: 8rpx 12rpx;
							border-radius: 5rpx;
							border: 1rpx solid #CCCCCC;
							margin-right: 10rpx;
							font-family: PingFang SC;
							font-weight: 400;
							font-size: 20rpx;
							color: #999999;
						}
					}
				}
			}
		}
		.txt {
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}
		.plr{
			padding: 0 30rpx;
		}
		.ftit{
			display: block;
			margin-bottom: 30rpx;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #111111;
		}



	}
</style>